home *** CD-ROM | disk | FTP | other *** search
- AmigaMain AmigaMain
-
- NAME
- AmigaMain - your main function
-
- SYNOPSIS
- int AmigaMain(void);
- void AmigaMain(void);
-
- #include <Amiga.h>
- struct WBStartupMsg *WorkbenchMessage;
-
- FUNCTION
- AmigaMain() is the function called by the startup code. Upon
- entry, the workbench message has been taken care of, and
- dos.library V37+ and utility.library V37+ have been opened.
-
- If the program is run from workbench, WorkbenchMessage points
- to the workbench startup message.
-
- If WorkbenchMessage==NULL the program was run from a shell. In
- this case, stdin, stdout and stderr are available.
-
- EXAMPLE
- #include <stdio.h>
- #include <Amiga.h>
- int AmigaMain(void)
- {
- if (!WorkbenchMessage)
- {
- printf("Hello World!\n");
- }
- return 0;
- }
-
- NOTE
- There is no command line parser. Use dos.library/ReadArgs().
- There is no automatic library opening. Use OpenLibrary().
-
- NOTE
- Using void AmigaMain(void) is defined, but that doesn't mean
- you don't need to pass a return value to the caller. Using
- void AmigaMain(void) requires you to use exit() to terminate
- the program. However, the compiler cannot enforce this, so it
- is *your* responsibility.
-
- NOTE
- Why is the entry point called AmigaMain() instead of main()?
- 1) Type clashes:
- MyLib ANSI/ISO C
- int AmigaMain(void); int main(void);
- ---- int main(int, char **);
- void AmigaMain(void); ----
- 2) GNU-C inserts some special code into your main() function.
- I don't want that to happen.
-
- SEE ALSO
- MyLib/exit()
-